<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue</title>
</head>
<body>
<div id="app">
    <!--    {{msg}}-->

    <!--    <p>-->

    <!--        <h3>Tonight,徐睿服侍?</h3>-->
    <!--        {{isok?'yes':'no'}}</p>-->

    <!--    <h1>ls的小三</h1>-->
    <!--    <span>{{lover}}</span>-->
    <!--    <button id="hitest" onclick="hi()">Click</button>-->
    <!--    <h2 v-html="msg"></h2>-->
    <img :src="img" style="width: 600px;height: 800px">
    <span v-on:click="hi($event)">1</span>
    <span @click="hi($event)">2</span>
    <span @click="hi($event)">3</span>
    <span @click="on(123,$event)">4</span>

</div>
https://juejin.im/entry/5a54b747518825734216c3df
<div>
    <input type="text" id="txt">
    <span id="sp"></span>

</div>

<script src="js/vue.js"></script>
<script>

    var vm = new Vue({
        el: "#app",
        data: {
            msg: '张雨绮梁晟的情人',
            isok: true,
            lover: {
                name: '章子怡',
                height: 170,
                price: ''
            },
            img: 'imgs/1.jpg',
            url: 'aa'
        },
        methods: {
            hi1() {

                this.img='imgs/1.jpg'
            },
            hi2() {
                console.log('hi2')
                this.img='imgs/2.jpg'
            },
            hi(e){
                var n=e.currentTarget.innerText
                console.log(n)

                this.img='imgs/'+n+".jpg"
            },
            on(data,e){
                alert(data)
            }

        }

    })


    var txt = document.getElementById('txt')
    var sp = document.getElementById('sp')
    // var hi=document.getElementById('hitest')

    obj = {}

    Object.defineProperty(obj, 'msg', {
        set: function (newVal) {
            txt.value = newVal
            sp.value = newVal
        }
    })

    txt.addEventListener('keyup', function (event) {
        console.log('keyup')
        obj.msg = event.target.value
        vm.img = 'imgs/' + event.target.value + ".jpg"
    })
    // hi.addEventListener('keypress',function (event) {
    //     console.log('hi click')
    //     Vue.set(vm.stu,'price',889)
    // })


</script>
</body>
</html>